from diffusers import StableDiffusionPipeline
import torch
import torch_npu
from torch_npu.contrib import transfer_to_npu
torch_npu.npu.set_compile_mode(jit_compile=False)
torch.cuda.set_device(2)
model_id = "/data_nvme0n1p2/hemuhui/pretrained_model/infer_ckpt/stable-diffusion-v1-5"
pipe = StableDiffusionPipeline.from_pretrained(model_id).to("cuda") #, torch_dtype=torch.float16


prompt = "A <cat-toy> backpack"

image = pipe(prompt, num_inference_steps=50, guidance_scale=7.5).images[0]

image.save("/data_nvme0n1p2/hemuhui/output/cat-backpack.png")